﻿@model DiscountUsageHistoryModel

@{
	var parentModel = ViewData["Parent"] as DiscountModel;
}

<datagrid id="discount-usage-history-grid" class="h-100"
          key-member="Id"
          allow-resize="true"
          allow-row-selection="true"
          allow-column-reordering="false"
          preserve-grid-state="true"
          max-height="650px">
    <datasource read="@Url.Action("DiscountUsageHistoryList", new { discountId = parentModel.Id })" delete="@Url.Action("DiscountUsageHistoryDelete")" />
    <paging position="Top" show-size-chooser="true" />
    <sorting allow-unsort="true" allow-multisort="false">
        <sort by="CreatedOn" descending="true" />
    </sorting>
    <toolbar>
        <zone name="datagrid_toolbar_alpha"></zone>
        <toolbar-group class="omega"></toolbar-group>
        <zone name="datagrid_toolbar_omega"></zone>
        <toolbar-group>
            <button datagrid-action="DataGridToolAction.DeleteSelectedRows" type="button" class="btn btn-danger no-anims btn-flat">
                <i class="far fa-trash-can"></i>
                <span>@T("Admin.Common.Delete.Selected")</span>
            </button>
        </toolbar-group>
    </toolbar>
    <row-commands>
        <a datarow-action="DataRowAction.Delete">@T("Common.Delete")</a>
    </row-commands>
    <columns>
        <column for="CreatedOn" width="auto" entity-member="CreatedOnUtc" />
        <column for="OrderId" hideable="false" width="1fr" entity-member="OrderId">
            <display-template>
                <div class="text-truncate"><a :href="item.row.OrderEditUrl" class="text-truncate">{{ item.row.OrderEditLinkText }}</a></div>
            </display-template>
		</column>
    </columns>
</datagrid>
